<template>
  <svg :style="{ width, height }">
    <!-- 'xlink:href' 执行哪个图标,属性值务必 '#icon-图标名称' 颜色使用fill="" -->
    <use :xlink:href="prefix + iconName" :fill="iconColor"></use>
  </svg>
</template>

<script setup lang="ts">
// 1.1 set props for parent component
// 1.11 dync props
defineProps({
  // xlink:href 属性值前缀
  prefix: {
    type: String,
    default: '#icon-',
  },
  iconName: String,
  // parent component can set color for icon
  // 1.12 props with default value
  iconColor: {
    type: String,
    default: '',
  },
  // 1.13 size config
  width: {
    type: String,
    default: '16px',
  },
  height: {
    type: String,
    default: '16px',
  },

  // iconName: {
  //     type: String,
  //     default: ''
  // }
})
</script>

<style scoped></style>
